export function StringFormat({ content, NumberFormat, DateTimeFormat }) {
  // console.log({ content, DateTimeFormat });
  if (DateTimeFormat && content) {
    content = content.replace(/\//g, "-");
    let dt = new Date(`${content}`);

    if (!isNaN(dt.getTime())) {
      dt = Date.UTC(
        dt.getFullYear(),
        dt.getMonth(),
        dt.getDate(),
        dt.getHours(),
        dt.getMinutes(),
        dt.getSeconds(),
        dt.getMilliseconds()
      );
      return new Intl.DateTimeFormat("default", DateTimeFormat).format(dt);
    } else {
      return content;
    }
  } else if (NumberFormat && content) {
    return new Intl.NumberFormat("en-US", NumberFormat).format(content) ?? "";
  } else if (content !== undefined && content !== null) return `${content}`;
  else return "";
}
